<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMemberCouponsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('member_coupons', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('member_id')->unsigned()->comment('用户id');
            $table->integer('red_id')->unsigned()->comment('红包id');
            $table->integer('coupon_id')->unsigned()->comment('卡券id');
            $table->integer('indate')->default(1)->unsigned()->comment('卡券有效期（1=永久有效，2=时间戳有效时间至）');
            $table->tinyInteger('status')->default(1)->unsigned()->comment('卡券状态(1=等待核销使用，2=已使用)');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('member_coupons');
    }
}
